<template>
    <buy-order-form :dialog="false" :type="formType" :detail="detail"
                    :row="rowData" :re-gen="reGen" />
</template>

<script>
import {AES} from "@common/utils/crypto";

export default {
    name: "JxcBuyOrderDetail",
    components: {
        BuyOrderForm: () => import("../components/BuyOrderForm.vue"),
    },
    computed: {
        rowData() {
            if (this.$utils.isNotEmpty(this.$route.query.sid)) {
                return {
                    sid: this.$route.query.sid,
                };
            }
            if (this.$utils.isNotEmpty(this.$route.query.select)) {
                try {
                    return JSON.parse(AES.de(this.$route.query.select))
                } catch (e) {
                }
            }
            return {};
        },
        detail() {
            return this.$route.path === '/jxcBuyOrderDetailView';
        },
        reGen() {
            return this.$route.path === '/jxcBuyOrderDetailNew';
        },
        formType() {
            if (this.$route.path === '/jxcBuyOrderDetailSale') {
                return 'sale2buy';
            }
            return 'buy';
        },
    },
}
</script>

<style scoped lang="less">

</style>
